package com.cc.service.impl;

import com.cc.mapper.ProductMapper;
import com.cc.model.EbProduct;
import com.cc.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    private ProductMapper productMapper;
    @Override
    public List<EbProduct> list(int page, int pageSize){
        return  productMapper.listByPage((page-1)*pageSize,pageSize);
    }

    @Override
    public int getMaxPage(int pageSize) {
        return productMapper.getMaxPage(pageSize);
    }

    @Override
    public int save(EbProduct ebProduct) {
        return productMapper.save(ebProduct);
    }

    @Override
    public EbProduct selectByCondition(Integer epId) {
        return productMapper.listById(epId);
    }

    @Override
    public int updateById(EbProduct ebProduct) {
        return productMapper.updateByPrimaryKey(ebProduct);
    }

    @Override
    public int deleteByPk(Integer id) {
        return productMapper.delete(id);
    }

}